package com.ymatou.iapi.doorgod.decisionengine.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.couponservice.parameter.GetAllSellerBatchInfosBean;
import com.ymatou.iapi.couponservice.service.GetAllSellerBatchInfosCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
/**
*门神验证
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_decisionengine{
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("门神验证");
	}

	@Before
	public void caseUp() {
		
	}

	@AfterClass
	public static void tearDown() {
		//Logger.generateResult(decisionengineCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_decisionengine_001() {
		Logger.start(true,"IP防刷");
		try {
			 GetAllSellerBatchInfosBean getallsellerbatchinfosBean = new GetAllSellerBatchInfosBean();
			 GetAllSellerBatchInfosCall getallsellerbatchinfosCall = new GetAllSellerBatchInfosCall();

			getallsellerbatchinfosCall.setData(getallsellerbatchinfosBean);
				
			for(int i=0;i<4000;i++)
			{
				Logger.comment("Num:"+(i+1));
				getallsellerbatchinfosCall.callService();

				Logger.verifyEquals("0", getallsellerbatchinfosCall.getCode(),
	                    "验证返回code");
			}
			
			getallsellerbatchinfosCall.callService();

			Logger.verifyEquals("0", getallsellerbatchinfosCall.getCode(),
                    "验证返回code");
			
			//验证拒绝了60s
			Thread.sleep(60100);
			getallsellerbatchinfosCall.callService();

			Logger.verifyEquals("0", getallsellerbatchinfosCall.getCode(),
                    "验证返回code");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}